/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * Project Name: lmrp-android app
 * Create Time: 16-2-16 下午6:30
 */

package com.lenovo.mso2o.biz;

import com.lenovo.framework.entity.Res;
import com.lenovo.mso2o.entity.Order;
import com.lenovo.mso2o.rest.OrderAPI;
import com.lenovo.mso2o.rest.ServiceGenerator;

import java.util.ArrayList;
import java.util.Map;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * @author JeffreyHe
 * @version 1.0
 * @created 17-一月-2016 14:19:39
 */
public class TicketManagerImpl implements ITicketManager {

	private OrderAPI apiService;

	public TicketManagerImpl(){
		apiService = ServiceGenerator.createService(OrderAPI.class);
	}

	public void finalize() throws Throwable {

	}

	@Override
	public Observable<Res<ArrayList<Order>>> getList(Map<String, String> params) {
		//1. encode  params
		//2. .subscribe on main ui thread {
		/*

		 */

		//apiService.orderList()
		return apiService.orderList(null)
				.subscribeOn(Schedulers.io())
				.observeOn(AndroidSchedulers.mainThread())
				.unsubscribeOn(Schedulers.io());
	}
}